Instruction reference guide

code sub-set instruction data field associated
instruction
remarks
CALL ASSEMBLY call assembly... assembly name - calls assembly code
CALL MAIN ASSY call assembly... main assembly name - calls main assembly code
CALL MODULE call module at address... address (label) - activates RETURN stack
COLOR sub-assy color color - sub-assy instruction
COMMENT comment comment -  
END OF PROJECT end of main project - - cannot be removed
this is not a RETURN instruction
GAUGE gauge (if size) gauge
(ft per pix)
- associated with the IF SIZE
instruction
GO TO LABEL jump to address address (label) - no RETURN
HIDDEN hidden polygon vertex indexes - sub-assy instruction
IF SIZE GO LABEL if size address (label) GAUGE  
INSERT ASSEMBLY merge assembly... assembly name - merges assembly code
INSERT MAIN ASSY merge assembly... main assembly name - merges main assembly code
cannot be removed
INTERNAL VIEW call assembly while
in internal view...
assembly name -  
LIMITS texture support texture support
and limits
- sub-assy instruction
MODEL SIZE model size model size -  
PROJECT beginning of main project project description - cannot be removed
RETURN return to the
calling instruction
- - associated with a stack of
return addresses
TRIANGLE visible triangle vertex indexes - sub-assy instruction

           sub-assy instruction
           second member of a combined pair

Combined pair of instructions

The IF SIZE instruction cannot be used alone: it is always associated with a GAUGE instruction. Both of them are forming a combined pair of instructions. The second member of this combined pair specifies the parameters to be applied when performing the action ordered by the first member. The second member of a combined pair of instructions has special features:


Branching instructions and the RETURN stack

The project code page is a kind of short program which is interpreted by the Flight Simulator viewer. The FS viewer loads one instruction after another and performs the action specified by the instruction. Some of the instructions are branching instructions. There are two kinds of branching instructions:

When it loads a jump instruction, the FS viewer simply jumps to the specified address.

When the FS viewer loads a module call:

  • it puts the address of the current instruction on top of the RETURN stack,
  • then it goes to the address specified by the instruction.
When the FS viewer loads a RETURN instruction:
  • it retrieves the address on the top of the RETURN stack,
  • it removes it from the stack,
  • it goes to the instruction at the retrieved address,
  • it goes to the next instruction.
If the FS viewer loads a RETURN instruction and the RETURN stack is empty, the model model viewing process is supposed to be finished and the FS viewer goes to the next object to be displayed (a scenery object or another aircraft).

What happens with the assemblies ?
You must think of the assembly as a piece of code which is ended by a RETURN instruction. When it is called by a CALL instruction (CALL MAIN ASSY or CALL ASSEMBLY), the FS viewer acts as described just before:
  • the FS viewer puts the address of the CALL ASSEMBLY instruction on the top of the RETURN stack,
  • it goes to the specified address (which is the address of the assembly),
  • it executes the assembly code (which means it draws the assembly),
  • then it goes back to the instruction immediately following the CALL ASSEMBLY instruction and removes the address of it from the RETURN stack.
When the FS viewer loads an INSERT instruction (INSERT MAIN ASSY or INSERT ASSEMBLY), it is acting as if it was a jump instruction. As the assembly code is ended by a RETURN instruction, once it is executed the FS viewer retrieves the address on the top of the RETURN stack which is NOT the address of the INSERT instruction. What happens ? If the stack is empty, the model viewing process is terminated. If it is not, the FS viewer simply goes to the retrieved address...


copyright Hervé Devred 2003